OpenStack Juno : How to use Ceilometer
2015/02/07 |
How to use the OpenStack Metering Service (Ceilometer).
This example is based on the environment like follows.
| +------------------+ | +------------------------+ | [ Control Node ] | | | [ Network Node ] | | Keystone |10.0.0.30 | 10.0.0.50| DHCP,L3,L2 Agent | | Glance |------------+------------| Metadata Agent | | Nova API |eth0 | eth0| Ceilometer Services | | Neutron Server | | | | +------------------+ | +------------------------+ eth0|10.0.0.51 +--------------------+ | [ Compute Node ] | | Nova Compute | | L2 Agent | | Ceilometer-Compute | +--------------------+ |
[1] | After configuring Configure Ceilometer#1, Configure Ceilometer#2, Configure Ceilometer#3, if configuration of them are done normally, the command of follows answers without errors like follows. |
[root@dlp ~(keystone)]# ceilometer meter-list +------------+-------+-------+--------------------------------------+---------+----------------------------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +------------+-------+-------+--------------------------------------+---------+----------------------------------+ | image | gauge | image | 4a663fce-97eb-42d3-93d6-415e477bc0a4 | None | e8f6ac69de5f46afa189fcefd99c8a1a | | image.size | gauge | B | 4a663fce-97eb-42d3-93d6-415e477bc0a4 | None | e8f6ac69de5f46afa189fcefd99c8a1a | +------------+-------+-------+--------------------------------------+---------+----------------------------------+ |
[2] | It's possible to monitor Compute Service (Nova) now. Try to create and start an instance, and next, input the command meter-list again, then meters are loged like follows. |
[root@dlp ~(keystone)]# Int_Net_ID=`neutron net-list | grep int_net | awk '{ print $2 }'` [root@dlp ~(keystone)]# nova boot --flavor 2 --image CentOS7 --security_group default --nic net-id=$Int_Net_ID CentOS_70 [root@dlp ~(keystone)]# ceilometer meter-list +---------------------+-------+----------+-----------------------+-----------------+-------------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +---------------------+-------+----------+-----------------------+-----------------+-------------------+ | disk.ephemeral.size | gauge | GB | f2784a7b-9480-4b6a... | a52762888677... | e8f6ac69de5f46... | | disk.root.size | gauge | GB | f2784a7b-9480-4b6a... | a52762888677... | e8f6ac69de5f46... | | image | gauge | image | 4a663fce-97eb-42d3... | None | e8f6ac69de5f46... | | image.size | gauge | B | 4a663fce-97eb-42d3... | None | e8f6ac69de5f46... | | instance | gauge | instance | f2784a7b-9480-4b6a... | a52762888677... | e8f6ac69de5f46... | | instance:m1.small | gauge | instance | f2784a7b-9480-4b6a... | a52762888677... | e8f6ac69de5f46... | | memory | gauge | MB | f2784a7b-9480-4b6a... | a52762888677... | e8f6ac69de5f46... | | port | gauge | port | c46f43f5-705c-4c2e... | 96b4c6f2c60d... | 9e657ab1d2344d... | | port.create | delta | port | c46f43f5-705c-4c2e... | 96b4c6f2c60d... | 9e657ab1d2344d... | | vcpus | gauge | vcpu | f2784a7b-9480-4b6a... | a52762888677... | e8f6ac69de5f46... | +---------------------+-------+----------+-----------------------+-----------------+-------------------+ |
[3] | Configure to enable monitoring Image Service (Glance). |
[root@dlp ~(keystone)]#
vi /etc/glance/glance-api.conf # line 210: uncomment and change notification_driver = messaging
# line 216: uncomment rpc_backend = 'rabbit' # line 220,221: uncomment and specify RabbitMQ server rabbit_host= 10.0.0.30 rabbit_port=5672 # line 223,224: specify RabbitMQ userID and password rabbit_userid= guest rabbit_password= password
[root@dlp ~(keystone)]# systemctl restart openstack-glance-api
# confirm the configuration [root@dlp ~(keystone)]# ceilometer meter-list +------------+-------+-------+--------------------------------------+---------+----------------------------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +------------+-------+-------+--------------------------------------+---------+----------------------------------+ | image | gauge | image | 4a663fce-97eb-42d3-93d6-415e477bc0a4 | None | e8f6ac69de5f46afa189fcefd99c8a1a | | image.size | gauge | B | 4a663fce-97eb-42d3-93d6-415e477bc0a4 | None | e8f6ac69de5f46afa189fcefd99c8a1a | +------------+-------+-------+--------------------------------------+---------+----------------------------------+ # try to add a new image [root@dlp ~(keystone)]# glance image-create --name="CentOS70" --is-public=true --disk-format=qcow2 --container-format=bare < /var/kvm/images/centos7.img [root@dlp ~(keystone)]# ceilometer meter-list +--------------+-------+-------+--------------------------------------+---------+----------------------------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +--------------+-------+-------+--------------------------------------+---------+----------------------------------+ | image | gauge | image | 4a663fce-97eb-42d3-93d6-415e477bc0a4 | None | e8f6ac69de5f46afa189fcefd99c8a1a | | image | gauge | image | e093db0c-2195-49a4-bfa2-dd813e6607d6 | None | e8f6ac69de5f46afa189fcefd99c8a1a | | image.size | gauge | B | 4a663fce-97eb-42d3-93d6-415e477bc0a4 | None | e8f6ac69de5f46afa189fcefd99c8a1a | | image.size | gauge | B | e093db0c-2195-49a4-bfa2-dd813e6607d6 | None | e8f6ac69de5f46afa189fcefd99c8a1a | | image.update | delta | image | e093db0c-2195-49a4-bfa2-dd813e6607d6 | None | e8f6ac69de5f46afa189fcefd99c8a1a | | image.upload | delta | image | e093db0c-2195-49a4-bfa2-dd813e6607d6 | None | e8f6ac69de5f46afa189fcefd99c8a1a | +--------------+-------+-------+--------------------------------------+---------+----------------------------------+ # meters are loged for Image Service |
[4] | Configure to enable monitoring Block Storage (Cinder). |
# change settings on both Control Node and Network Node [root@dlp ~(keystone)]# vi /etc/cinder/cinder.conf # add in the [DEFAULT] section
control_exchange=cinder
notification_driver=cinder.openstack.common.notifier.rpc_notifier # Control Node [root@dlp ~(keystone)]# systemctl restart openstack-cinder-api openstack-cinder-scheduler # Network Node [root@network ~]# systemctl restart openstack-cinder-volume
# confirm the configuration [root@dlp ~(keystone)]# ceilometer meter-list +------------+-------+-------+--------------------------------------+---------+----------------------------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +------------+-------+-------+--------------------------------------+---------+----------------------------------+ | image | gauge | image | 4a663fce-97eb-42d3-93d6-415e477bc0a4 | None | e8f6ac69de5f46afa189fcefd99c8a1a | | image.size | gauge | B | 4a663fce-97eb-42d3-93d6-415e477bc0a4 | None | e8f6ac69de5f46afa189fcefd99c8a1a | +------------+-------+-------+--------------------------------------+---------+----------------------------------+[root@dlp ~(keystone)]# cinder create --display_name disk01 10 [root@dlp ~(keystone)]# ceilometer meter-list +-------------+-------+--------+-----------------------+-----------------+----------------------------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +-------------+-------+--------+-----------------------+-----------------+----------------------------------+ | image | gauge | image | 4a663fce-97eb-42d3... | None | e8f6ac69de5f46afa189fcefd99c8a1a | | image.size | gauge | B | 4a663fce-97eb-42d3... | None | e8f6ac69de5f46afa189fcefd99c8a1a | | volume | gauge | volume | fc17f001-492b-4752... | a52762888677... | e8f6ac69de5f46afa189fcefd99c8a1a | | volume.size | gauge | GB | fc17f001-492b-4752... | a52762888677... | e8f6ac69de5f46afa189fcefd99c8a1a | +-------------+-------+--------+-----------------------+-----------------+----------------------------------+ # meters are loged for Block Storage Service |
[5] | Configure to enable monitoring Network Service (Neutron). |
# change settings on Control Node, Network Node, Compute Node [root@dlp ~(keystone)]# vi /etc/neutron/neutron.conf # line 428: uncomment and add notification_driver= neutron.openstack.common.notifier.rpc_notifier
# Control Node [root@dlp ~(keystone)]# systemctl restart neutron-server # Network Node [root@network ~]# systemctl restart neutron-dhcp-agent neutron-l3-agent neutron-metadata-agent neutron-openvswitch-agent # Compute Node [root@node01 ~]# systemctl restart neutron-openvswitch-agent
# confirm the configuration [root@dlp ~(keystone)]# ceilometer meter-list +------------+-------+-------+--------------------------------------+---------+----------------------------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +------------+-------+-------+--------------------------------------+---------+----------------------------------+ | image | gauge | image | 4a663fce-97eb-42d3-93d6-415e477bc0a4 | None | e8f6ac69de5f46afa189fcefd99c8a1a | | image.size | gauge | B | 4a663fce-97eb-42d3-93d6-415e477bc0a4 | None | e8f6ac69de5f46afa189fcefd99c8a1a | +------------+-------+-------+--------------------------------------+---------+----------------------------------+[root@dlp ~(keystone)]# neutron net-create test_net [root@dlp ~(keystone)]# ceilometer meter-list [root@dlp ~(keystone)]# ceilometer meter-list +----------------+-------+---------+-----------------------+------------------+----------------------------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +----------------+-------+---------+-----------------------+------------------+----------------------------------+ | image | gauge | image | 4a663fce-97eb-42d3... | None | e8f6ac69de5f46afa189fcefd99c8a1a | | image.size | gauge | B | 4a663fce-97eb-42d3... | None | e8f6ac69de5f46afa189fcefd99c8a1a | | network | gauge | network | 438080d6-5176-4da4... | a527628886774... | e8f6ac69de5f46afa189fcefd99c8a1a | | network.create | delta | network | 438080d6-5176-4da4... | a527628886774... | e8f6ac69de5f46afa189fcefd99c8a1a | +----------------+-------+---------+-----------------------+------------------+----------------------------------+ # meters are loged for Network Service |